package com.mtzqc.common.utils

import com.blankj.utilcode.util.ThreadUtils

object ThreadUtil {

    fun runMain(runnable: Runnable): Runnable {
        return runMainDelayed(0, runnable)
    }

    fun runMainDelayed(delayMillis: Long = 200, runnable: Runnable): Runnable {
        ThreadUtils.getMainHandler().postDelayed(runnable, delayMillis)
        return runnable
    }

    fun remove(runnable: Runnable?) {
        runnable?.let {
            ThreadUtils.getMainHandler().removeCallbacks(it)
        }
    }
}